#ifndef __ILISTCONTAINER_H__
#define __ILISTCONTAINER_H__

#include "CTypes.h"

template <typename T>
class IListContainer : public std::list<T*>
{
public:
	IListContainer()
	{
	}

	virtual ~IListContainer()
	{
	}

	bool DeleteNode(T *Node)
	{
#ifdef _MSC_VER
		for (std::list<T*>::iterator it=this->begin();it!=this->end();)
#else
		for (std::_List_iterator<T*> it=this->begin();it!=this->end();)
#endif
		{
			T *ActualNode = *it;
			if (Node == ActualNode)
			{
				this->erase(it);
				delete ActualNode;
				return true;
			}
			it++;
		}
		return false;
	}

	void DeleteListNodes()
	{
		while (this->size() > 0)
		{
			DeleteNode(*(this->begin()));
		}
	}

};

#endif
